package com.hopedove.workshop.data.pojo

import androidx.databinding.ObservableBoolean
import androidx.databinding.ObservableField
import androidx.databinding.ObservableInt

data class ObservableRunningSituation(
    val id: String,
    val material: String,
    val machine: String,
    val remark: ObservableField<String> = ObservableField(""),
    val reason: ObservableField<String> = ObservableField(""),
    val duration: ObservableField<String> = ObservableField(""),
    val checked: ObservableBoolean = ObservableBoolean(false),
    val processInfo: String? = null,
    val creator: String = "",
    val currentLoginCreator: String = "",
    val planTypes: List<String>,
    val planTypeSelection: ObservableInt = ObservableInt(0)
) {

    val selectedPlanType: String
        get() {
            return if (planTypes.isEmpty()) ""
            else planTypes[planTypeSelection.get()]
        }

    // 没有处理信息 且 creator 与当前登录 creator 一致
    fun canModify() = processInfo == null && currentLoginCreator == creator


}
